/**
 * @param numbers 知道请求接口编号
 * @param message 当前业务名称
 * @param appBody 请求头
 * @param that    传入 当前this
 * @returns {resultData} 当前请求到的数据
 *     :String,message:String,appBody:any, that:any
 * 
 */
export let get_3xxx = async (numbers: String, message: String, appBody: any, that: any, bool: boolean = true, boolerr: boolean = true) => {
    // 3xxx 配置请求头
    const defaultParams = JSON.parse(JSON.stringify(that.defaultParams));
    defaultParams.body.appHead.tranCode = numbers;
    defaultParams.body.appBody = appBody;
    // 发送_3xxx请求 
    try {
        const resData = await that.$post.common.transPort(
            defaultParams
        );
        // console.log(resData, numbers);
        if (resData.status === 200) {
            const resultData = JSON.parse(resData.data.jsonRes);
            // console.log(resultData, numbers);
            // 失败之后报错提示
            if (resultData.sysHead.rspCd === "AG0001") {
                that.isLoading = false;
                // that.$alert(
                //     `错误代码：${resultData.sysHead.rspCd}，错误信息：${numbers + "接口配置错误!"}`,
                //     message + "操作失败！",
                //     {
                //         confirmButtonText: "确定",
                //         center: true,
                //         customClass: "error", type: 'error',
                //         showClose: false
                //     }
                // );
                return false
            }
            if (resultData.sysHead.rspCd !== "000000") {

                // console.log(resultData.sysHead.rspMsg, resultData.sysHead.rspDesc)
                that.isLoading = false;
                // if (boolerr) {
                //     that.$alert(
                //         `错误代码：${resultData.sysHead.rspCd}，错误信息：${resultData
                //             .sysHead.rspMsg || resultData.sysHead.rspDesc}`,
                //         message + "操作失败！",
                //         {
                //             confirmButtonText: "确定",
                //             center: true,
                //             customClass: "error", type: 'error',
                //             showClose: false
                //         }
                //     );
                // }
                return false
            }
            // 成功之后当前显示
            that.isLoading = false
            if (bool) {
                // that.$message.success( message + "获取数据成功");
            }
            //   数据存在 resultData.body.appBody
            return resultData
        }
        that.isLoading = false;
    } catch (error) {
        //that.$message.error(message + "获取数据失败");
        that.isLoading = false;
    }
    that.isLoading = false;
}

export let get_4xxx = async (numbers: String, message: String, appBody: any, that: any, bool: boolean = true, boolerr: boolean = true) => {
    // 4075 配置请求头
    const defaultParams = JSON.parse(JSON.stringify(that.defaultParams));
    defaultParams.body.appHead.tranCode = numbers;
    defaultParams.body.appBody = appBody;
    // 发送_4073请求
    try {
        const resData = await that.$post.common.transPort(
            defaultParams
        );
        // console.log(resData, numbers);
        if (resData.status === 200) {
            const resultData = JSON.parse(resData.data.jsonRes);
            // console.log(resultData, numbers);
            if (resultData.sysHead.rspCd !== "000000") {
                that.isLoading = false;
                if (boolerr) {
                    that.$alert(
                        `错误代码：${resultData.sysHead.rspCd}，错误信息：${resultData
                            .sysHead.rspMsg || resultData.sysHead.rspDesc}`,
                        message + "操作失败！",
                        {
                            confirmButtonText: "确定",
                            customClass: "warning",
                            type: 'warning',
                            showClose: false
                        }
                    );
                }

                return false
            }
            // 成功之后当前显示
            that.isLoading = false
            if (bool) {
                // that.$message.success( message + "获取数据成功");
            }
            //   数据存在 resultData.body.appBody
            return resultData
        }
        that.isLoading = false;
    } catch (error) {
        that.$message.error(message + "获取数据失败");
        that.isLoading = false;
    }
    that.isLoading = false;
}

export let get_FQxx = async (numbers: String, message: String, appBody: any, that: any, bool: boolean = true, boolerr: boolean = true) => {
    // 4075 配置请求头
    const inlineParams = JSON.parse(JSON.stringify(that.inlineParams));
    inlineParams.body.appHead.tranCode = numbers;
    inlineParams.body.appBody = appBody;
    // 发送_4073请求
    try {
        const resData = await that.$post.inlineTransModule.transFQ01(
            inlineParams
        );
        // console.log(resData, numbers);
        if (resData.status === 200) {
            const resultData = JSON.parse(resData.data.jsonRes);
            // console.log(resultData, numbers);
            if (resultData.sysHead.rspCd !== "000000") {
                that.isLoading = false;
                if (boolerr) {
                    that.$alert(
                        `错误代码：${resultData.sysHead.rspCd}，错误信息：${resultData
                            .sysHead.rspMsg || resultData.sysHead.rspDesc}`,
                        message + "操作失败！",
                        {
                            confirmButtonText: "确定",
                            customClass: "warning ",
                            type: 'warning',
                            showClose: false
                        }
                    );
                }

                return false
            }
            // 成功之后当前显示
            that.isLoading = false
            if (bool) {
                // that.$message.success( message + "获取数据成功");
            }
            //   数据存在 resultData.body.appBody
            return resultData
        }
        that.isLoading = false;
    } catch (error) {
        that.$message.error(message + "获取数据失败");
        that.isLoading = false;
    }
    that.isLoading = false;
}